<template>
  <div class="wrap">
    <div class="header">
      <div class="left">
        <select-country
          class="query-select"
          v-model="queryParams.country"
          @change="changeOption">
        </select-country>
        <select-shop
          class="query-select"
          v-model="queryParams.shopId"
          @change="changeOption">
        </select-shop>
        <select-deliver
          class="query-select"
          v-model="queryParams.deliverStatus"
          @change="changeOption">
        </select-deliver>

        <select-goods
          class="query-select"
          v-model="queryParams.goodsOrigin"
          @change="changeOption">
        </select-goods>
      </div>
      <div class="right">
        <div style="display: inline-block;margin-right: 20px;">
          <el-input size="small" style="width: 200px" v-model="queryParams.keyword" placeholder="搜索 店铺或用户名"></el-input>
          <el-button size="small" type="primary">搜索</el-button>
        </div>
        <el-button size="small" type="success">导 出</el-button>

      </div>
    </div>
    <div class="content">
      <el-table
        v-loading="loading"
        :data="data"
        border
      >
        <el-table-column
          prop="orderNo"
          label="订单编号"
          align="center"
        >
        </el-table-column>
        <el-table-column
          prop="country"
          label="站点"
          align="center"
        >
          <template slot-scope="{}">
            <img class="img-country-icon" :src="getCountryIcon('cn')" alt="">

          </template>
        </el-table-column>
        <el-table-column
          prop="shopId"
          label="店铺名(用户名)"
          align="center"
        >
        </el-table-column>
        <el-table-column
          prop="goodsNum"
          label="商品数量"
          align="center"
        >
        </el-table-column>
        <el-table-column
          prop="goodsOrigin"
          label="商品来源"
          align="center"
        >
        </el-table-column>
        <el-table-column
          prop="deliverStatus"
          label="快递状态"
          align="center"
        >
        </el-table-column>
        <el-table-column
          prop="createTime"
          label="订单时间"
          align="center"
        >
        </el-table-column>
        <el-table-column
          label="操作"
          align="center"
        >
          <template slot-scope="{row}">
            <diy-link @click="jumpInfo(row)">查看</diy-link>
          </template>
        </el-table-column>
      </el-table>
      <div class="page-wrap">
        <el-pagination
          background
          layout="prev, pager, next"
          :current-page.sync="queryParams.page"
          :page-size="queryParams.pageSize"
          :total="count"
          @current-change="getData"
        >
        </el-pagination>
      </div>
    </div>

  </div>
</template>

<script>
import SelectCountry from "@/views/order/components/SelectCountry";
import SelectShop from "@/views/order/components/SelectShop";
import SelectDeliver from "@/views/order/components/SelectDeliver";
import SelectGoods from "@/views/order/components/SelectGoods";
import {getCountryIcon} from "@/utils/common";

export default {
  name: "stickerList",
  components: {
    SelectCountry,SelectShop,SelectDeliver,SelectGoods
  },
  data(){
    return {
      getCountryIcon,
      loading: false,
      queryParams: {
        page: 1,
        pageSize: 20,
        country : '', // 国家（站点）
        shopId : '', // 店铺(待定)
        deliverStatus : '', // 快递状态
        goodsOrigin: '', // 商品来源
        keyword: '',
      },
      data:[],
      count: 0,
    }
  },
  created() {
    // this.setQueryParams()
    this.getData();
  },
  methods:{
    // 获取表单数据
    getData(){
      this.data = [
        {
          orderNo: '',
          country: '',
          shop: '',
          goodsNum: 0, // 商品数量
          goodsOrigin: '', // 商品来源
          goodsOriginStr: '', // 商品来源
          deliverStatus: '', // 快递状态
          deliverStatusStr: '', // 快递状态
          createTime: '', // 订单时间
        }
      ];
    },
    // 触发变更事件
    changeOption(){
      this.queryParams.page = 1
      this.getData()
      console.log(this.queryParams)
    },
    // 跳转到订单详情页
    jumpInfo(row){
      this.$router.push({
        name:'orderInfo',
      })
    },
  }
}
</script>

<style scoped lang="less">
.wrap {
  padding: 30px 30px;
  .header{
    display: flex;
    justify-content: space-between;
  }
  .content{
    padding: 20px 0 0;
  }
}

</style>

<style lang="less">
.channel-form{
  &.el-form{
    .el-form-item__label{
      word-break: break-word;
    }
  }
}
.channel-box-card{
  .el-card__header{
    padding: 5px 10px;
    font-size: 12px;
    line-height: 26px;
  }
  .el-card__body{
    padding: 0;
  }
}
.query-select{
  margin-right: 20px;
}

</style>
